<template>
	<view class="info-pages">
		<view class="price-item">开票金额共：<view class="price">￥{{price}}</view>
		</view>
		<view class="info-block">
			<view class="info-item">
				<view class="name-item">
					<view class="must">*</view>
					<view class="name">发票类型</view>
				</view>
				<view class="menu-item">
					<view class="menu" :class="form.menuTab==1?'active':''" @click="form.menuTab=1">全电专票</view>
					<view class="menu" :class="form.menuTab==2?'active':''" @click="form.menuTab=2">全电普票</view>
				</view>
			</view>
			<view class="info-item">
				<view class="name-item">
					<view class="must">*</view>
					<view class="name">抬头类型</view>
				</view>
				<view class="menu-item">
					<view class="menu active">个人</view>
				</view>
			</view>
			<view class="info-item">
				<view class="name-item">
					<view class="must">*</view>
					<view class="name">发票抬头</view>
				</view>
				<view class="form-item">
					<input v-model="form.invoice" placeholder="请填写发票抬头" maxlength="15" class="form_crl" />
					<view class="iconfont icon-taitoubao" @click="navigate('/page_pack/invoice/manage')"><text
							style="margin-left: 10rpx;">抬头薄</text></view>
				</view>
			</view>
			<view class="info-item">
				<view class="name-item">
					<view class="must"></view>
					<view class="name">纳税人识别号</view>
				</view>
				<view class="form-item">
					<input v-model="form.number" placeholder="请填写购买方纳税人识别号" maxlength="15" class="form_crl1" />
				</view>
			</view>
			<view class="info-item">
				<view class="name-item">
					<view class="must">*</view>
					<view class="name">收票人邮箱</view>
				</view>
				<view class="form-item">
					<input v-model="form.Email" placeholder="请填写收票人邮箱" maxlength="20" />
				</view>
			</view>
		</view>
		<view class="btn normal" @click="submit">下一步</view>
	</view>
</template>

<script>
	import {
		validate
	} from '@/util/validate.js';
	export default {
		data() {
			return {
				price: 0,
				form: {
					menuTab: 1,
					invoice: '',
					number: '',
					Email: ''
				},
				rule: {
					invoice: {
						name: '发票抬头',
						required: true,
					},
					Email: {
						name: '收票人邮箱',
						required: true,
					},
				}
			}
		},
		methods: {
			submit() {
				if (validate(this.form, this.rule)) {
					this.navigate('/page_pack/invoice/apply')
				}
			}
		},
		onLoad(e) {
			this.price = e.price
		}
	}
</script>

<style lang="scss" scoped>
	.info-pages {
		padding: 30rpx;

		.price-item {
			padding: 40rpx 30rpx;
			border-radius: 20rpx;
			background-color: #fff;
			display: flex;
			align-items: center;

			.price {
				font-weight: bold;
			}
		}

		.info-block {
			padding: 30rpx;
			background-color: #fff;
			border-radius: 30rpx;
			margin-top: 30rpx;

			.info-item {
				margin-bottom: 30rpx;

				.name-item {
					display: flex;
					align-items: center;
					margin-bottom: 30rpx;

					.must {
						color: $theme-color;
					}

					.name {
						font-size: 30rpx;
					}
				}

				.menu-item {
					display: flex;
					align-items: center;
					justify-content: space-between;

					.menu.active {
						border: 1px solid $theme-color;
						color: $theme-color;
						background-color: #fff;
					}

					.menu {
						width: calc(50% - 15rpx);
						background-color: #eeeeee;
						display: flex;
						align-items: center;
						justify-content: center;
						height: 70rpx;
						border-radius: 60rpx;
					}
				}

				.form-item:last-child {
					border-bottom: none;
					margin-bottom: 0;
					padding-bottom: 0;
				}

				.form-item {
					display: flex;
					align-items: center;
					justify-content: space-between;
					border-bottom: 1px solid #f7f7f7;
					margin-bottom: 30rpx;
					padding-bottom: 30rpx;

					.iconfont {
						font-size: 28rpx;
					}

					.form_crl {
						width: calc(100% - 160rpx);
					}

					.form_crl1 {
						width: 100%;
					}
				}
			}
		}

		.btn {
			border-radius: 20rpx;
			margin-top: 30rpx;
		}
	}
</style>